package com.zhss.redis.hash;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;

/**
 * @ClassName SessionDemo
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/9/10 22:38
 * @Version 1.0
 */
public class SessionDemo {
	Jedis jedis = new Jedis(new HostAndPort("121.4.79.149", 6379));

	public boolean checkSessionStatus(String token) {
		if (token == null || "".equalsIgnoreCase(token)) {
			return false;
		}
		String key = "sessions::" + token;
		String session = jedis.hget("sessions", key);

		if (session == null || "".equalsIgnoreCase(session)) {
			return false;
		}
		//todo 过期时间校验
		return true;

	}
}
